<!--
 * @Author: sundl
 * @Date: 2021-04-08 14:56:57
 * @project: 天津YQ平台
-->
<template>
  <el-row class>
    <ModuleCard>
      <template v-slot:header>基本信息</template>
      <detail-form :list="formFilds"> </detail-form>

      <!-- 附件 -->
      <!-- <ModuleCard>
        <template v-slot:header>附件</template>
        <dg-row>
          <Enclosure :files="form.fileHolderList" />
        </dg-row>
      </ModuleCard> -->
    </ModuleCard>
  </el-row>
</template>

<script>
import DetailForm from '@/components/detail-form';
import ModuleCard from '@/components/layout/module-card';
// import Enclosure from '@/components/layout/enclosure';
import { fetchPoliceDetail } from '@/api/common';
import { PoliceInfoFeilds } from './config.js';

export default {
  name: 'police-baseInfo',
  props: {},
  components: {
    ModuleCard,
    // Enclosure,
    DetailForm
  },
  computed: {
    detailId() {
      // jqxxbh
      return this.$route.params.id;
    },
    detailType() {
      return this.$route.query.type;
    }
  },
  data() {
    return {
      PoliceInfoFeilds,
      form: {},
      formFilds: []
    };
  },

  mounted() {
  },

  methods: {
    init() {
      this.fetchDetail();
    },
    fetchDetail() {
      fetchPoliceDetail(this.detailId).then(res => {
        this.form = JSON.parse(JSON.stringify(res.data));
        const fields = PoliceInfoFeilds;
        // 基本信息
        let infoCols = JSON.parse(JSON.stringify(fields));
        infoCols.flatMap(item => {
          item.forEach(cItem => {
            cItem.value = this.form[cItem.field];
          });
        });
        this.formFilds = infoCols;
      });
    }
  },
  created() {
    this.init();
  }
};
</script>

<style lang="scss" scoped>
.wrap {
  .info-title {
    margin-bottom: 20px;
  }
  .item-radio {
    height: 20px;
    align-self: center;
    margin-left: 8px;
  }
  &-title {
    font-weight: bolder;
    margin-bottom: 10px;
  }
  &-upload {
    margin-bottom: 20px;
    /deep/.el-upload {
      display: none;
    }
  }

  /deep/.el-form-item {
    margin-bottom: 5px;
  }
}

/deep/.el-date-editor.el-input {
  width: 100%;
}
</style>
